Revision: tla--devo--1.3.1--patch-5
Archive: lord@emf.net--2005
Creator: Thomas Lord <lord@emf.net>
Date: Sat Feb 12 22:53:06 PST 2005
Standard-date: 2005-02-13 06:53:06 GMT
Modified-files: libarch/apply-changeset.c
    libarch/archive-mirror.c libarch/archive-pfs.c
    libarch/archive-setup.c libarch/archive-snapshot.c
    libarch/archive.c libarch/archives.c
    libarch/build-revision.c libarch/changelogs.c
    libarch/changeset-report.c libarch/cmd-abrowse.c
    libarch/cmd-ancestry-graph.c libarch/cmd-ancestry.c
    libarch/cmd-archive-setup.c libarch/cmd-archives.c
    libarch/cmd-cachedrevs.c libarch/cmd-commit.c
    libarch/cmd-get.c libarch/cmd-grab.c
    libarch/cmd-library-add.c
    libarch/cmd-library-revisions.c libarch/cmd-logs.c
    libarch/cmd-merges.c libarch/cmd-missing.c
    libarch/cmd-rbrowse.c libarch/cmd-replay.c
    libarch/cmd-revisions.c libarch/cmd-star-merge.c
    libarch/cmd-tag.c libarch/cmd-update.c
    libarch/cmdutils.c libarch/commit.c libarch/configs.c
    libarch/file-diffs.c libarch/import.c
    libarch/inode-sig.c libarch/inv-ids.c
    libarch/libraries.c libarch/library-txn.c
    libarch/make-changeset-files.c libarch/make-changeset.c
    libarch/merge-points.c libarch/missing.c libarch/my.c
    libarch/namespace.c libarch/patch-logs.c
    libarch/pfs-dav.c libarch/pfs-ftp.c libarch/pfs.c
    libarch/pristines.c libarch/proj-tree-lint.c
    libarch/replay.c libarch/star-merge.c
    libarch/sync-tree.c libarch/undo.c libarch/whats-new.c
    libawk/relassoc.c libawk/relational.c
    libawk/relational.h libfsutils/copy-file.c
    libfsutils/find-utils.c libfsutils/link-tree.c
    libfsutils/rmrf.c
New-patches: lord@emf.net--2005/tla--devo--1.3.1--patch-5
    lord@emf.net--libawk-exp-2005/tla--no-direct-reltable-slot-access--1.3.1--base-0
    lord@emf.net--libawk-exp-2005/tla--no-direct-reltable-slot-access--1.3.1--patch-1
    lord@emf.net--libawk-exp-2005/tla--no-direct-reltable-slot-access--1.3.1--patch-2
    lord@emf.net--libawk-exp-2005/tla--no-direct-reltable-slot-access--1.3.1--patch-3
    lord@emf.net--libawk-exp-2005/tla--no-direct-reltable-slot-access--1.3.1--patch-4
    lord@emf.net--libawk-exp-2005/tla--no-direct-reltable-slot-access--1.3.1--version-0
    lord@emf.net--libawk-exp-2005/tla--no-direct-reltable-slot-access--1.3.1--versionfix-1
Summary: [on bug libawk-api-bogosities] step 1 of libawk cleanup
Keywords: 


  Relational tables were publicly declared this way:

  [[tty
    typedef t_uchar * rel_field;
    typedef rel_field * rel_record;
    typedef rel_record * rel_table;
  ]]

  Consequently, client code could (and in some instances did) use the
  following and similar idioms to modify a relational table element's
  value:

  [[tty
	rel_table a_table;

        [...]

        old_value = a_table[x][y];
        a_table[x][y] = str_save (0, new_value);
        lim_free (0, old_value);
  ]]

  Such client code errantly presumes too much about how table elements
  are allocated and freed and the direct assignment into a table
  obligates the `libawk' implementation to honor the client's
  expectations about memory management.

  This change fixes that problem by first changing the declaration
  of a relational table to:

  [[tty
    struct rel_field
    {
      t_uchar * _f;
    };

    typedef struct rel_field rel_field;
    typedef rel_field * rel_record;
    typedef rel_record * rel_table;
  ]]

  and then fixing, in the simplest way, all other code broken
  by that change.

  Two new functions, `rel_ref_str' and `rel_set_str' are introduced.
  Those functions replace direct references to relational table slots
  this way:

  [[tty
               New Procedural Abstractions in `libawk'


	old idiom:			new idiom:

       s = table[x][y];		      s = rel_ref_str (table, x, y);


       table[x][y] 		      rel_set_str (table, x, y, s);
         = str_save (0, s);
  ]]


  (Note the slight change in memory management discipline in the
  second row of the table above.)

